<extend name="Public/base"/>
<block name="body">
  
	<!-- 标题栏 -->
	<div class="main-title">
        <include file="Zuopin@Admin/_top_nav"/>
	</div>

	    <div  class="with-padding">
                <div class="fl">
                    <a href="" class="btn btn-success">下载导入模板</a>&nbsp;
                    
                    <a href="{:U('addClass')}" class="btn btn-ajax btn-success btn">新增</a>&nbsp;
                    <button class="btn ajax-post btn-info btn" url="/web2016/index.php?s=/admin/Zuopin/setcategorystatus.html&amp;status=1" target-form="ids">启用</button>&nbsp;
                    <button class="btn ajax-post btn-warning btn" url="/web2016/index.php?s=/admin/Zuopin/setcategorystatus.html&amp;status=0" target-form="ids">禁用</button>&nbsp;
                    <button class="btn ajax-post btn-danger btn" target-form="ids" onclick="del();">删除</button>&nbsp;
                </div>

            </div>
    <div class="with-padding">
        <form id="zuopinform" action="{:U('zuopinMark')}"  method="post" class="form-horizontal">
          <div class="col-md-7">
           <div class="input-group">
              <span class="input-group-addon fix-padding">班级</span>                             
                      <select name="bj_code" id="bj_code" class="form-control" onchange="this.form.submit()">
                      <volist name="classlist" id="v">
                      <option value="{$v.bj_code}" <eq name="map.bj_code" value="$v['bj_code']"> selected </eq>>{$v.bj_name}</option>
                      </volist> 
                      </select> 
              <span class="input-group-addon fix-border">课题</span>                             
                      <select name="title_id" id="t_id" class="form-control" onchange="this.form.submit()">
                      <option value="0">所有课程</option>
                      <volist name="tlist" id="v">
                      <option value="{$v.id}" <eq name="map.lid" value="$v['id']"> selected </eq>>{$v.title}</option>
                      </volist>            
                      </select> 
              <span class="input-group-addon fix-border fix-padding">学生姓名</span>
               <input type="text" class="form-control" name="st_name" value="{$st_name}" placeholder="输入姓名查询">
              <span class="input-group-btn">
                <button class="btn btn-primary" type="submit">&nbsp;查询&nbsp;</button>
              </span>
            </div>
        </div>
        <div class="col-md-5">
        批量设置为：
                        <button type="button" id="A" class="btn btn-success" >&nbsp;90&nbsp;</button>
                        <button type="button" id="B" class="btn btn-info" >&nbsp;80&nbsp;</button>
                        <button type="button" id="C" class="btn btn-warning" >&nbsp;70&nbsp;</button>
                        <button type="button" id="D" class="btn btn-danger" >&nbsp;60&nbsp;</button>

        填写后点提交

        </div>
        <p>
        <br/>
        </p>
        <div class="col-md-11">
        <table class="table table-bordered">
          <thead>
            <tr>
              <th><input id="check-all" class="check-all" type="checkbox"/>全选</th><th>课程</th><th>文件名</th><th>班级</th><th>作者姓名</th><th>上传日期</th>
              <th>评分</th>
            </tr>
          </thead>
          <tbody>
          <volist name="zuopinlist" id="vo">
            <tr>
              <td><input class="ids" type="checkbox" value="{$vo.id}" name="ids[]">{$vo.id}</td>
              <td>{$vo.title}</td><td>{$vo.file_url}</td><td>{$vo.bj_code|get_bjname}</td><td>{$vo.st_code}{$vo.name}</td>
              <td>{$vo.create_time|date='Y-m-d',###}</td>
              <td>
                <input class="score" type="text" name="data[{$i}][score]" value="{$vo.score}" >
                <input type="hidden" name="data[{$i}][id]" value="{$vo.id}" >
                <input type="hidden" name="data[{$i}][name]" value="{$vo.name}" >
              </td>
            </tr>
            </volist>
          </tbody>
        </table>

        <div class="form-group">
        <div class="col-md-9">
          <input type="submit" class="btn btn-primary" value="保存" />
          </div>
        </div>
        </div>
    </form>
    </div>
    <script>
       $(".check-all").on('click',function() {  
            $("input[name='id[]']").prop("checked", this.checked);
      });  
          
      $("input[name='id']").on('click',function() {  
            var $subs = $("input[name='id[]']"); 
            $("#check-all").prop("checked" , $subs.length == $id.filter(":checked").length ? true :false);  
      });

     </script>


<script type="text/javascript">
function del(){
document.forms.zuopinform.action="{:U('doDel')}";
document.forms.zuopinform.submit();
}
    function checktid(){
       if($("#t_id").val()==0){
	        alert('请选择课程，未选择课程时，不能批量设置分值');
	        return false;     
       }
     }  

    $(function(){
    	   
     $("button#A").click(function(){
      checktid();
      $(".score").val("90");
       alert('已成功将所有学生成绩设置为：90');  
      });

    $("#B").click(function(){
    	checktid();
      $(".score").val("80");
      alert('已成功将所有学生成绩设置为：80');
    
    });

    $("#C").click(function(){
    	checktid();
      $(".score").val("70");
      alert('已成功将所有学生成绩设置为：70');
    });

      $("#D").click(function(){
      checktid();
      $(".score").val("60");
      alert('已成功将所有学生成绩设置为：60');
    });

  }); 
</script> 

</block>